home *** CD-ROM | disk | FTP | other *** search
/ Adobe Digital Video Collection / Digital Video Collection CD.iso / After Effects 5.5 / MMScriptEng.Cab / F115586_span.mm < prev    next >
Encoding:
Text File  |  2001-12-07  |  1.3 KB  |  28 lines

  1. // Span - Version 1.0
  2. // This script takes the layer assigned to span_layer and scales/rotates/translates
  3. // it so that it stretches between the layers chosen in popups one and two.
  4.  
  5. //      LAYER                                               PROPERTY                     CHANNEL
  6. //      ------                                              ----------                     --------
  7. // 1: layer to stretch from                        doesn't matter                doesn't matter
  8. // 2: layer to stretch to                            doesn't matter                doesn't matter
  9. //
  10. // span_layer: layer which is stretched between layers 1 and 2
  11.  
  12. span_layer = "your layer here";                // change to your own layer's name or number
  13.  
  14. l1 = pop_layer(1);
  15. l2 = pop_layer(2);
  16.  
  17. // Assign position to midpoint between l1 and l2
  18. value(span_layer, position) = (value(l1, position) + value(l2, position)) / 2;
  19.  
  20. // compute the vector between l1 and l2
  21. delta = value(l1, position) - value(l2, position);
  22.  
  23. // compute the rotation of the layer by converting the vector to degrees
  24. value(span_layer, rotation) = -rad_to_deg( atan2(delta[X], delta[Y]) ) + 90;
  25.  
  26. // assign the scale of the span layer to the distance between the two other layers
  27. value(span_layer, scale)[X] = length(delta) / layer_size(span_layer)[X] * 100;
  28.